#pragma once

//  Include "petscksp.h" so that we can use KSP solvers.  Note that this file
//  automatically includes:
//     petsc.h       - base PETSc routines   petscvec.h - vectors
//     petscsys.h    - system routines       petscmat.h - matrices
//     petscis.h     - index sets            petscksp.h - Krylov subspace methods
//     petscviewer.h - viewers               petscpc.h  - preconditioners
//
#include "petscksp.h"

class parallelFE
{
public:

  // initialize PETSC and MPI
  parallelFE(void);

  ~parallelFE(void);

  // begin assemble of matrix and vectors and set dimension of problem
  int beginAssemble (int N);


  int insertLocalStiffnessMatrix (int ndof, int *indexs, double *K);

  // end assemble of matrix and vectors
  int endAssemble (void);

private:

  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  //       Compute the matrix and right-hand-side vector that define
  //       the linear system, Au = b.
  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  Vec  *u, *b, *ustar; /* approx solution, RHS, exact solution */
  Mat  *A;             /* linear system matrix */


  PetscMPIInt    rank;        /* processor rank */
  PetscMPIInt    size;        /* size of communicator */

};
